home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
mvhelp
/
vwr_help.bas
< prev
next >
Wrap
BASIC Source File
|
1995-05-09
|
3KB
|
73 lines
'**************************************************************************
'* Sample VB code for Context Sensitive Help using Multimedia Viewer... *
'* Copyright ⌐ 1994 Robert W. McGregor. Use Freely. *
'**************************************************************************
' Yes, Viewer be used to create context sensitive help for VB apps, just
' like WinHelp can. While it *is* like WinHelp on steroids, with a lot of
' the same functionality, Viewer needs more coaxing to get the job done.
' Without writing a custom DLL this was the simplest way I could think of
' doing it...
' Instead of the HelpContextID property (which is numerical, and Viewer
' won't accept a [MAP] section in the MVP file), use the form or control
' TAG property. Set the Tag to the context string used in your RTF.
' Then you can trap the F1 keypress, pass the Tag as a context string to
' Viewer using the Viewer API, and presto, Context Sensitive Multimedia Help!
'
' Please note that a VB Form can't get the focus unless all controls are
' disabled, so I've used a Help button to get help on the form itself.
' Maybe there's a better way, but this seems pretty straight forward. If
' anyone knows of a better (i.e. simpler) way to do this, let me know, eh?
'
' See-ya!
' Rob McGregor, Screaming Tiki Software
' CIS 73122,3125
Option Explicit
' Viewer functions...
Declare Function HwndFromVwr% Lib "mvapi2.dll" (ByVal hWnd%)
Declare Function VwrCommand% Lib "mvapi2.dll" (ByVal iVwr%, ByVal szMVB As Any, ByVal szMacro$, ByVal iCmdOptions%)
Declare Function VwrFromMVB% Lib "mvapi2.dll" (ByVal szMVB$)
Declare Function VwrQuit% Lib "mvapi2.dll" (ByVal iVwr%)
Declare Function VwrFromHwnd% Lib "mvapi2.dll" (ByVal hWnd%)
Declare Function VwrFromHinst% Lib "mvapi2.dll" (ByVal hInst%)
Declare Function VwrGetInfo% Lib "mvapi2.dll" (ByVal iVwr%, ByVal iInfoMsg%, ByVal lParam1&, ByVal lParam2&)
' Viewer Defs...
Global Const cmdoptNONE = 0
Global Const cmdoptHIDE = 1
Global szTitle$ ' Path of the Viewer title
Global vwr% ' Viewer handle
Global hwndVwr% ' Viewer Hwnd
' F1 function key
Global Const VK_F1 = &H70
Sub JumpTopic (sztopic$)
Dim temp
' attempt a jump to the topic...
temp = VwrCommand(vwr, szTitle$, "JumpID(qchPath,`" & sztopic$ & "')", cmdoptNONE)
If temp = 0 Then Exit Sub
End Sub
Sub StartViewer ()
Dim msg$
' See if Viewer's running. If not, start it...
szTitle$ = "VWR_HELP.MVB"
vwr% = VwrFromMVB(szTitle$)
If vwr% = 0 Then
' Viewer needs a command to get loaded so I use the BrowseButtons() command
' with cmdoptHIDE to prevent flashing while JumpTopic brings up a topic...
vwr% = VwrCommand(0, szTitle$, "BrowseButtons()", cmdoptHIDE)
If vwr% = 0 Then
msg = "The file " + szTitle$ + " was not found in your system's PATH."
MsgBox msg, 48
Exit Sub
End If
End If
End Sub